package reportBuilder;

public class Field
{	
	public int ORDERING;
	/** This is the array of strings for Field
	 * 0 = FIELD_NAME;
	 * 1 = FIELD_DISPLAY_NAME;
	 * 2 = DESCRIPTION;
	 * 3 = SORTABLE;
	 * 4 = DEFAULT_SELECTED;
	 * 5 = DEFAULT_SORT_ORDER;
	 * 6 = DATA_TYPE;
	 * 7 = FUNCTION;
	 * 8 = VALUE_INFO;
	 * 9 = DISPLAY;
	 */
	public String[] field = new String[10];
	
	public Field(int ordering, String[] field) {
		ORDERING = ordering;
		this.field = field;
	}

	public Field() {
		StringBuilder sb =  new StringBuilder();
		field[0] = sb.append(new char[] {}).toString();
		field[1] = sb.toString();
		field[2] = sb.toString();
		sb.setLength(0);
		field[3] = sb.append(new char[] {'T'}).toString();
		field[4] = sb.toString();
		field[9] = sb.toString();
		sb.setLength(0);
		field[5] = sb.append(new char[] {}).toString();
		field[7] = sb.toString();
		field[8] = sb.toString();
		sb.setLength(0);
		field[6] = sb.append(new char[] {'T','E','X','T'}).toString();

		ORDERING = -1;
	}
	
	public void printField()
	{
		if (Debug.debug) {
			for (int i = 0; i < field.length; i++) {
				System.out.print(field[i] + " -*- ");
			}
			System.out.println(ORDERING);
		}
	}

	public void clear() {
		if (field != null) {
			for (int i = 0; i < field.length; i++) {
				field[i] = null;
			}
			field = null;
		}
	}
}